daqhats128#3
Conversation
Merge long to main
…ange and to choose the channel
3rd version with the acquisition function and functions to setmode, r…
Code nettoye
seb5g
left a comment
There was a problem hiding this comment.
You've done a good job, still some things to fix, see below!
| @@ -0,0 +1,134 @@ | |||
| import numpy as np | |||
There was a problem hiding this comment.
you have to remove this file
| 'limits': ['RISING_EDGE', 'FALLING_EDGE', 'ACTIVE_HIGH', | ||
| 'ACTIVE_LOW']}, | ||
| {'title': 'External_clock', 'name': 'extclock_mode', 'type': 'bool', 'value': False}, | ||
| {'title': 'External sampling rate', 'name': 'extclock_rate', 'type': 'int', 'value': 0}, |
There was a problem hiding this comment.
you could add here a 'visible': False option and when a user click on extclockmode, the action in the commit settings would be to show the extclock rate:
if param.name() == 'extclock_mode':
self.settings.child('extclock_rate').setVisible(param.value())
| {'title': 'External sampling rate', 'name': 'extclock_rate', 'type': 'int', 'value': 0}, | ||
| {'title': 'Number of samples:', 'name': 'num_sample', 'type': 'int', 'value': 1000, 'min': 0}, | ||
| {'title': 'Sampling rate :', 'name': 'sampling_rate', 'type': 'int', 'value': 10000, 'min': 0, 'max': 100000}, | ||
| {'title': 'Range', 'name': 'range', 'type': 'list', 'value': 10, 'limits': [10, 5, 2, 1]}, |
There was a problem hiding this comment.
specify the units : Range (V)
| self.list_channel_names = [] | ||
|
|
||
| def commit_settings(self, param: Parameter): | ||
|
|
There was a problem hiding this comment.
remove this empty line, also a docstring should be as this:
def scan_data(self, totalsamples: int, scan_rate: int, name_channel: int):
""" Short description
Longer description if needed
Parameters
-----------
...
"""
There was a problem hiding this comment.
please apply this to all your docstrings (which are already nice by the way!)
|
|
||
| self.settings.child('channel_on', 'CH0H').setValue(True) | ||
|
|
||
| self.data_signal = self.scan_data(self.settings['num_sample'], self.settings['sampling_rate'], |
There was a problem hiding this comment.
delete lines 280 up to line 288, we should not grab data at this stage
| if len(signal) != 0: # Condition to avoid empty data error | ||
| self.data_signal = self.get_data(signal, self.num_channels) | ||
|
|
||
| self.dte_signal.emit(DataToExport('myplugin', data=[DataFromPlugins(name='Mock1', data=self.data_signal, |
There was a problem hiding this comment.
replace 'myplugin' by a meaningfull name (same for Mock1)
| @@ -0,0 +1,31 @@ | |||
| # Initializing an empty list | |||
There was a problem hiding this comment.
what is this file for? If nothing anymore, please delete it
Delete the unnecessary files and update the docstring
|
J'ai corrigé le code. Est ce que vous pouvez le revoir ? |
| [plugin-install] | ||
| #packages required for your plugin: | ||
| packages-required = ['pymodaq>=4.0.0', 'daqhats'] | ||
| packages-required = ['pymodaq>=4.0.0', 'picamera2'] |
There was a problem hiding this comment.
there should be only one list including all necessary packages, here you created two similar lines...
| self.settings.child('extclock_rate').setOpts(visible = param.value()) | ||
|
|
||
| def scan_data(self, totalsamples: int, scan_rate: int, name_channel: int): | ||
|
|
| return voltage.data | ||
|
|
||
| def set_range(self): | ||
|
|
| self.controller.a_in_range_write(self.range) | ||
|
|
||
| def set_mode(self): | ||
|
|
| self.controller.a_in_mode_write(self.mode) | ||
|
|
||
| def set_trigger(self): | ||
|
|
|
|
||
| """ | ||
|
|
||
| global Tmode |
| """Terminate the communication protocol""" | ||
|
|
||
| def grab_data(self, Naverage=1, **kwargs): | ||
|
|
remove the empty lines and correct file plugin_info.toml
On a nettoye le code et mis les commentaires pour chaque methodes